<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta content="text/html;charset=utf-8"></meta>
    <title>用户维护</title>
    <link rel="stylesheet" href="/static/js/common/bootstrap/css/bootstrap.min.css"></link>
    <link rel="stylesheet" href="/static/js/common/layer/theme/default/layer.css"></link>
    <link rel="stylesheet" href="/static/css/base.css"></link>

    <script src="/static/js/common/jquery/jquery-3.2.1.min.js"></script>
    <script src="/static/js/common/layer/layer.js"></script>
    <script src="/static/js/base/base.js"></script>
    <script>
        //记录翻页
        function listRecord(data, nowPageNo) {
            var pageSize = "${listResult.pageSize}";
            var url = "${basePath}" + "/sys/user/pageList";
            defaultPageRecord(pageSize, nowPageNo, url);
        }

        //删除记录
        function deleteRecord(data) {
            var url = "${basePath}" + "/sys/user/delete/";
            defaultDelRecord(data, url);
        }

        //修改模态窗弹出
        function modifyModal(data) {
            var url = "${basePath}" + "/sys/user/info/";
            defaultSkipModifyModal(data, url);
        }

        //修改提交
        function modifyRecord() {
            var url = "${basePath}" + "/sys/user/modify/";
            defaultUpdateRecord(url)
        }

        //新增提交
        function addRecord() {
            var url = "${basePath}" + "/sys/user/add/";
            defaultAddRecord(url);
        }

    </script>
</head>
<body>
 <@_top.top 1/>
<div class="container" style="padding-bottom: 15px;min-height: 300px; padding-top: 60px;">
    <div class="row">
        <@_left.role 0/>
        <div class="col-md-10">
            <h2>列表</h2>
            <hr>
            <form class="form-inline" id="queryForm" role="form">
                <input type="text" name="username" class="form-control" id="queryName" placeholder="请输入名称">
                <button type="button" onclick="listRecord(this)" class="btn btn-primary">查询</button>
                <button type="button" class="btn btn-success" data-toggle="modal" data-target="#modal_add" >添加</button>
                <!-- 表示应谨慎采取的动作 -->
            </form>
            <hr>
            <!-- 表格 -->
            <div id="list_table">
            <table class="table table-hover table-bordered" id="role_grade">
            <#--<caption>悬停表格布局</caption>-->
                <thead>
                <tr>
                    <th>序号</th>
                    <th>常量名</th>
                    <th>常量标签</th>
                    <th>常量值</th>
                    <th>组名</th>
                    <th>组标签</th>
                    <th>排序</th>

                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <#list listResult.list as sysConstantVO>
                <tr>
                    <td style="display: none" id="id_${sysConstantVO.id}">${sysConstantVO.id}</td>
                    <td id="index">${sysConstantVO_index  + 1}</td>
                    <td id="consName_${sysConstantVO.id}">${sysConstantVO.consName?default("")}</td>
                    <td id="consLabel_${sysConstantVO.id}">${sysConstantVO.consLabel?default("")}</td>
                    <td id="consValue_${sysConstantVO.id}">${sysConstantVO.consValue?default("")}</td>
                    <td id="groupName_${sysConstantVO.id}">${sysConstantVO.groupName?default("")}</td>
                    <td id="groupLabel_${sysConstantVO.id}">${sysConstantVO.groupLabel?default("")}</td>
                    <td id="sort_${sysConstantVO.id}">${sysConstantVO.sort?default("")}</td>

                    <td>
                        <button id="update" type="button" onclick="modifyModal(this)" class="btn btn-warning">修改</button>
                        <button id="delete" type="delete" onclick="deleteRecord(this)" class="btn btn-danger">删除</button>
                    </td>
                </tr>
                </#list>
                </tbody>
            </table>
            </div>

            <nav aria-label="Page navigation" style="text-align: right">
                <ul class="pagination" id="table_pagging">
                    <#assign pageNum=listResult.totalPageNo>
                    <#if pageNum==0>
                        <#assign pageNum=1>
                    </#if>
                    <#list 1..pageNum as pn>
                        <li id="a_${pn}" class="${(pn==listResult.nowPageNo)?string('disabled','')}"><a onclick="${(pn==listResult.nowPageNo)?string('','listRecord(this, ${pn})')}" href="#" >${pn}</a></li>
                    </#list>
                </ul>
            </nav>
        </div>
    </div>
</div>

<div class="modal fade" id="modal_add" style="padding-top: 150px" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    新增
                </h4>
            </div>
            <div class="modal-body">
                <form id="form_add" class="form-horizontal" role="form">
                    <div class="form-group hidden">
                        <label for="firstname" class="col-sm-2 control-label">ID</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="userId" name="id" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">常量名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="consName_add" name="consName" placeholder="请输入常量名" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">常量标签</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="consLabel_add" name="consLabel" placeholder="请输入常量标签" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">常量值</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="consValue_add" name="consValue" placeholder="请输入常量值" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">组名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="groupName_add" name="groupName" placeholder="请输入组名" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">组标签</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="groupLabel_add" name="groupLabel" placeholder="请输入组标签" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">排序</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="sort_add" name="sort" placeholder="请输入排序" value="">
                        </div>
                    </div>

                </form>
            </div>
            <div class="modal-footer">
                <button type="button" id="modalCancel" onclick="function close() {
                            $('#modal_add').modal('hide');
                        }" class="btn btn-default" data-dismiss="modal">取消
                </button>
                <button type="button" id="button_add" onclick="addRecord()" class="btn btn-primary">
                    提交
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<div id="info_modify">
    <div class="modal fade" id="modal_modify" style="padding-top: 150px" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        修改
                    </h4>
                </div>
                <#if result??>
                <div class="modal-body">
                    <form id="form_modify" class="form-horizontal" role="form">
                        <div class="form-group hidden">
                            <label for="firstname" class="col-sm-2 control-label">ID</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="userId" name="id" value="${result.id?default("")}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="firstname" class="col-sm-2 control-label">常量名</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="consName_modify" name="consName" placeholder="请输入常量名" value="${result.consName?default("")}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="firstname" class="col-sm-2 control-label">常量标签</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="consLabel_modify" name="consLabel" placeholder="请输入常量标签" value="${result.consLabel?default("")}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="firstname" class="col-sm-2 control-label">常量值</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="consValue_modify" name="consValue" placeholder="请输入常量值" value="${result.consValue?default("")}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="firstname" class="col-sm-2 control-label">组名</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="groupName_modify" name="groupName" placeholder="请输入组名" value="${result.groupName?default("")}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="firstname" class="col-sm-2 control-label">组标签</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="groupLabel_modify" name="groupLabel" placeholder="请输入组标签" value="${result.groupLabel?default("")}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="firstname" class="col-sm-2 control-label">排序</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="sort_modify" name="sort" placeholder="请输入排序" value="${result.sort?default("")}">
                            </div>
                        </div>

                    </form>
                </div>
                </#if>
                <div class="modal-footer">

                    <button type="button" id="modalCancel" onclick="function close() {
                                $('#modal_modify').modal('hide');
                            }" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="button" id="button_modify" onclick="modifyRecord()" class="btn btn-primary">
                        保存
                    </button>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>


<script src="/static/js/common/bootstrap/js/bootstrap.min.js"></script>

</body>

</html>





